package cn.wolfcode.luowowo.common.query;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject {
    private Integer state = -1;
    private Long destId = -1L;

    //前台传入的原始数据
    private Integer orderType = -1;
    private Integer travelTimeType = -1;
    private Integer perExpendType = -1;
    private Integer dayType = -1;


    //提供getter在mapper中调用,进行翻译
    public String getOrderBy() {
        return orderType.equals(1) ? "t.releaseTime desc" : "t.viewnum desc";
    }

    public TravelCondition getTravelTime() {
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }

    public TravelCondition getPerExpend() {
        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
    }

    public TravelCondition getDay() {
        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }

}
